'use strict';

// Declare app level module which depends on views, and components
angular.module('myApp', [
    'ngRoute',
    'myApp.view1',
    'myApp.view2',
    'myApp.viewLogin',
    'myApp.viewTaskList',
    'myApp.viewAddNewTask',
    'myApp.viewTaskDetail',
    'myApp.version'
]).config(['$routeProvider', function ($routeProvider) {
    $routeProvider.when('/view1', {
        templateUrl: 'views/view1/view1.html',
        controller: 'View1Ctrl'
    })

    .when('/view2', {
        templateUrl: 'views/view2/view2.html',
        controller: 'View2Ctrl'
    })

    .when('/login', {
        templateUrl: 'views/login/view_login.html',
        controller: 'ViewLogin'
    })

    .when('/:userName/tasklist', {
        templateUrl: 'views/task_list/view_task_list.html',
        controller: 'ViewTaskList'
    })

    .when('/:userName/addtask', {
        templateUrl: 'views/add_new_task/view_add_new_task.html',
        controller: 'ViewAddNewTask'
    })

    .when('/:userName/taskdetail/:taskId', {
        templateUrl: 'views/task_detail/view_task_detail.html',
        controller: 'ViewTaskDetail'
    })

    .otherwise({ redirectTo: '/login' });
}]);